
package com.jf.cloud.supplier.controller.multishop;


import com.jf.cloud.api.auth.constant.SysTypeEnum;
import com.jf.cloud.api.platform.feign.OfflineHandleEventFeignClient;
import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.common.security.AuthUserContext;
import com.jf.cloud.supplier.dto.SupplierDetailDTO;
import com.jf.cloud.supplier.service.SupplierDetailService;
import com.jf.cloud.supplier.vo.SupplierDetailVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author zz
 */
@RestController("supplierShopDetailController")
@RequestMapping("/m/supplier_detail")
@Tag(name = "supplier-供应商")
public class SupplierDetailController {

    @Autowired
    private SupplierDetailService supplierDetailService;
    @Autowired
    private OfflineHandleEventFeignClient offlineHandleEventFeignClient;

    @GetMapping("/page_supplier")
    @Operation(summary = "供应商列表" , description = "供应商列表")
    public ServerResponseEntity<PageVO<SupplierDetailVO>> pageSupplier(@Valid PageDTO pageDTO, @ParameterObject SupplierDetailDTO supplierDetailDTO) {
        Long shopId = AuthUserContext.get().getTenantId();
        supplierDetailDTO.setSysType(SysTypeEnum.MULTISHOP.value());
        return ServerResponseEntity.success(supplierDetailService.pageSupplier(pageDTO,supplierDetailDTO,shopId));
    }


}
